<!-- 引进图片插件 begin -->
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/uploadify/jquery.uploadify.min.js" ></script>
<link rel="stylesheet" charset="utf-8" type="text/css" href="__PUBLIC__/admin/js/uploadify/uploadify.css"> 
<!-- 引进图片插件 end-->
<style type="text/css">
  .bg{background: none; border:none;}
</style>
 <div class="container-fluid">
  <div class="row-fluid">
    <div class="span12">
    <form role="form" id="form" action="{:U('Activity/update_research',array('id'=>$list['id']))}">    
    <div class="form-group">
      <label for="name">问卷调查的标题</label>
      <input type="text" class="form-control" value="{$list.name}" name="title" required="required" />
   </div>
    <!-- 内容描述 -->
   <div class="form-group">
      <label for="name">描述</label>
      <input type="text" class="form-control" value="{$list.description}" name="description" required="required" />
   </div>
  
     <!-- <div class="form-group">
      <label for="name">选择奖品</label>
      <select name="aid" form="form">
        <option value="{$arr.id}">
            <if condition="$list.aid eq '0'">无奖品</if>
            <if condition="$list.aid neq '0'">{$arr.name}</if>
        </option>    
        <option value="{$v.id}">
          {$v.name}
        </option>
      </select>
        </div> -->

      <div class="checkbox">
      <label>
         <volist name="v" id="data">
             <br />
             <input type="checkbox" name="checkbox[]" value="{$data.id}"  
            <foreach name="arr" item="v">
            <if  condition="$data.id eq $v">
              checked
            </if>
            </foreach>     
            />
          {$data.name}
         </volist> 
      </label>
   </div>

  
    <div class="form-group">
     <div id="feng">
      <label for="name">封面照片<span style="color: red;">(*双击图片删除,只能有一张图片)</span></label>
      <input type="file" class="form-control" id="upload" placeholder="图片上传"> <br />
      <input type="hidden" name="cover" value="{$list.img}" id="img">
      <div id="view" style="height:200px;">
        <a href="javascript:void(0);"  ondblclick="delimg(this)" id="{$list.img}"><div style="float: left;width:120px;"class="'+obj.d+'"><img style="height:120px; width: 120px;" src="__PUBLIC__/upload/image/{$list.img}"/><span style=" width: 120px;  height:40px; line-height: 20px; ">{$list.img}</span></div></a>
      </div>
   </div>
    </div>


     <!-- 问卷调查的状态 -->
 <div class="form-group">
     <label for="name">是否开启</label>
      <div class="radio">
        <label>
          <input type="radio" name="state"  value="0" <if condition="$list['state'] eq '0'"> checked </if> />
         关闭
        </label>
      </div>
      <div class="radio">
        <label>
          <input type="radio" name="state"  value="1" <if condition="$list['state'] eq '1'"> checked </if> />
         开启
        </label>
    </div>
</div>
    <button type="submit" class="btn btn-default">提交</button>
</form>
    </div>
  </div>
</div>

<script language="javascript">
//图片删除
function delimg(a){
var data={data:a.id};
url="{:U('WxContent/delimg')}";
$.post(url, data,function(c){   
  if(c.s){
  alert("删除成功");
  var el = document.getElementById(''+c.id+''); 
    el.parentNode.removeChild(el); 
  }else{
  alert("图片不存在，删除失败");
   var el = document.getElementById(''+c.id+''); 
    el.parentNode.removeChild(el); 
  }
});
}
$(function(){
  $("#upload").uploadify({
        'height'        : 30,
        'width'         : 90, 
    'buttonClass'   :'bg', 
    'queueSizeLimit': 6,    
        'buttonText'    :'<button type="submit" class="btn btn-primary "><span class="glyphicon glyphicon-plus">选择图片</span><tton>',
        'swf'           : '__PUBLIC__/admin/js/uploadify/uploadify.swf',
        'uploader'      : "{:U('WxContent/upload')}",
        'auto'          : true,
        'multi'         : true,      
        'fileTypeExts'  : '*.jpg;*.jpge;*.gif;*.png',
        'fileSizeLimit' : '2MB', 
        'onUploadSuccess':function(file,data,response){
             var obj = eval('('+data+')');         
       if(obj.s){
  $('#view').append('<a href="javascript:void(0);"  ondblclick="delimg(this)" id="'+obj.d+'.'+obj.c+'"><div style="float: left;width:120px;"class="'+obj.d+'"><img style="height:120px; width: 120px;" src="__PUBLIC__/upload/image/'+obj.d+'.'+obj.c+'"/><span style=" width: 120px;  height:40px; line-height: 20px; ">'+obj.d+'.'+obj.c+'</span></div></a>');
        var a=$("#img").val(obj.d+'.'+obj.c);
       // alert(a);
        $('#view').fadeIn();        
       }    
        }
    });
}); 
</script>